package com.itheima.reggie.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author kcs
 * @date 2021/11/20
 * @TIME:16:28
 */
@Configuration
public class MyBatisPlusConfig {

    @Bean
    public MybatisPlusInterceptor getMpInterceptor(){

        //拦截器容器
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();

        //向容器中添加分页拦截器
        InnerInterceptor innerInterceptor = new PaginationInnerInterceptor();
        interceptor.addInnerInterceptor(innerInterceptor);

        return interceptor;

    }

}
